#ifndef EVM_HTTP_UTIL_H
#define EVM_HTTP_UTIL_H

#include <unordered_map>
#include <string>
#include "common/str.h"


namespace evm {
    namespace http {

        enum HTTPMethod
        {
            DELETE,
            GET,
            HEAD,
            POST,
            PUT,
            CONNECT,
            OPTIONS,
            TRACE
        };

        // using QueryParams = std::vector<std::pair<std::string, std::string>>;

        struct ihash {
            size_t operator()(const std::string& key) const noexcept {
                static std::hash<std::string> h;
                return h(str::lower(key));
            }
        };

        struct iequal {
            bool operator()(const std::string& l, const std::string& r) const noexcept {
                return str::iequals(l, r);
            }
        };

        using Headers = std::unordered_multimap<std::string, std::string, ihash, iequal>;

        const std::string &get_header(const Headers &headers, const std::string &field);

    }
}

#endif //EVM_HTTP_UTIL_H
